import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/PostStudentForm")
public class PostStudentForm extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //注意如果是通过表单提交构建的POST请求不会对
        //body中转码的字符进行自动解码，所以要手动通过设置
        //req请求的字符集未utf8
       req.setCharacterEncoding("utf8");
        String studentId=req.getParameter("studentId");
        String classId=req.getParameter("classId");
        System.out.println(studentId);
        System.out.println(classId);
        resp.setContentType("text/html;charset=utf8");
        resp.getWriter().write("student:"+studentId+" , "+"classId:"+classId);
        float f=-545;
        //int g=(int)true;
        //byte s=(byte)128;\
        long y=012;
        double c=0x12345678;

    }
}
